package com.flowerplus.store.app.photo;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.WindowManager;
import android.widget.ProgressBar;

import com.flowerplus.store.R;
import com.flowerplus.store.common.data.utils.glide.GlideUtil;
import com.flowerplus.store.common.structure.mvp.BasePresenter;
import com.flowerplus.store.common.structure.ui.activity.BaseActivity;
import com.github.chrisbanes.photoview.PhotoView;


/**
 * 查看大图
 */
public class PhotoMaxActivity extends BaseActivity {

    private PhotoView mPhotoView;
    private ProgressBar mProgressBar;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        // 隐藏状态栏
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void initData() {
        Intent intent = getIntent();
        String compressUrl = intent.getStringExtra("compressUrl");
        String originUrl = intent.getStringExtra("originUrl");
        GlideUtil.loadThumbnail(this, compressUrl, originUrl, mPhotoView,mProgressBar);
    }
    @Override
    protected void initEvents() {
        mPhotoView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    @Override
    protected void initViews() {
        mPhotoView = (PhotoView) findViewById(R.id.photo_view);
        mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
    }

    @Override
    public void initInject() {

    }

    @Override
    protected int layoutResId() {
        return R.layout.activity_photo_max;
    }

    protected BasePresenter getPresenter() {
        return null;
    }
}
